package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsPageCountReadDao;
import com.party.core.dao.write.analysis.StatisticsPageCountWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.PageListOutput;
import com.party.core.model.analysis.StatisticsModulePVUV;
import com.party.core.model.analysis.StatisticsPageCounter;
import com.party.core.service.analysis.IStatisticsPageCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 页面流程统计接口实现
 * @author: yuguangqing
 * @create: 2018-08-01 11:59
 **/

@Service
public class StatisticsPageCountService implements IStatisticsPageCountService {

    @Autowired
    private StatisticsPageCountWriteDao statisticsPageCountWriteDao;

    @Autowired
    private StatisticsPageCountReadDao statisticsPageCountReadDao;


    @Override
    public boolean batchInsert(List<StatisticsPageCounter> pageCounterList) {
        pageCounterList.stream().forEach(pageCounter -> BaseModel.preInsert(pageCounter));
        return statisticsPageCountWriteDao.batchInsert(pageCounterList);
    }

    @Override
    public List<StatisticsPageCounter> listPageByOthers(StatisticsPageCounter pageCounter,
                                                 Map<String, Object> params, Page page) {
        return statisticsPageCountReadDao.listPageByOthers(pageCounter, params, page);
    }

    @Override
    public String insert(StatisticsPageCounter pageCounter) {
        BaseModel.preInsert(pageCounter);
        return statisticsPageCountWriteDao.insert(pageCounter) ? pageCounter.getId() : null;
    }

    @Override
    public boolean update(StatisticsPageCounter pageCounter) {
        return pageCounter == null ? null : statisticsPageCountWriteDao.update(pageCounter);
    }

    @Override
    public boolean deleteLogic(String id) {
        return statisticsPageCountWriteDao.deleteLogic(id);
    }

    @Override
    public boolean delete(String id) {
        return statisticsPageCountWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return statisticsPageCountWriteDao.batchDeleteLogic(ids);
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return statisticsPageCountWriteDao.batchDelete(ids);
    }

    @Override
    public StatisticsPageCounter get(String id) {
        return statisticsPageCountReadDao.get(id);
    }

    @Override
    public List<StatisticsPageCounter> listPage(StatisticsPageCounter pageCounter, Page page) {
        return null;
    }

    @Override
    public List<StatisticsPageCounter> list(StatisticsPageCounter pageCounter) {
        return null;
    }

    @Override
    public List<StatisticsPageCounter> batchList(Set<String> ids, StatisticsPageCounter pageCounter, Page page) {
        return null;
    }

    @Override
    public List<StatisticsModulePVUV> getModulePVUV(StatisticsPageCounter pageCount, Map<String, Object> params, Page page) {
        return statisticsPageCountReadDao.getModulePVUV(pageCount,params,page);
    }
}
